import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
    import news from '@/views/modules/news/list'
    import zuoyepiyue from '@/views/modules/zuoyepiyue/list'
    import ketangzuoye from '@/views/modules/ketangzuoye/list'
    import richanghuodong from '@/views/modules/richanghuodong/list'
    import ketangpingjia from '@/views/modules/ketangpingjia/list'
    import ketangdianming from '@/views/modules/ketangdianming/list'
    import ketangqingjia from '@/views/modules/ketangqingjia/list'
    import xueyuan from '@/views/modules/xueyuan/list'
    import ketangqiandao from '@/views/modules/ketangqiandao/list'
    import zuoyetijiao from '@/views/modules/zuoyetijiao/list'
    import shoukejiaoshi from '@/views/modules/shoukejiaoshi/list'
    import discusskechengxinxi from '@/views/modules/discusskechengxinxi/list'
    import kechengxinxi from '@/views/modules/kechengxinxi/list'
    import kechengleixing from '@/views/modules/kechengleixing/list'
    import xuexijilu from '@/views/modules/xuexijilu/list'
    import jiaoxueban from '@/views/modules/jiaoxueban/list'
    import discussrichanghuodong from '@/views/modules/discussrichanghuodong/list'
    import huodongbaoming from '@/views/modules/huodongbaoming/list'
    import jiaofujiaoshi from '@/views/modules/jiaofujiaoshi/list'
    import huodongpingjia from '@/views/modules/huodongpingjia/list'
    import config from '@/views/modules/config/list'
    import kechengjindu from '@/views/modules/kechengjindu/list'
    import huodongleixing from '@/views/modules/huodongleixing/list'
    import newstype from '@/views/modules/newstype/list'


//2.配置路由   注意：名字
export const routes = [{
    path: '/',
    name: '系统首页',
    component: Index,
    children: [{
      // 这里不设置值，是把main作为默认页面
      path: '/',
      name: '系统首页',
      component: Home,
      meta: {icon:'', title:'center', affix: true}
    }, {
      path: '/updatePassword',
      name: '修改密码',
      component: UpdatePassword,
      meta: {icon:'', title:'updatePassword'}
    }, {
      path: '/pay',
      name: '支付',
      component: pay,
      meta: {icon:'', title:'pay'}
    }, {
      path: '/center',
      name: '个人信息',
      component: center,
      meta: {icon:'', title:'center'}
    }
      ,{
	path: '/news',
        name: '通知公告',
        component: news
      }
      ,{
	path: '/zuoyepiyue',
        name: '作业批阅',
        component: zuoyepiyue
      }
      ,{
	path: '/ketangzuoye',
        name: '课堂作业',
        component: ketangzuoye
      }
      ,{
	path: '/richanghuodong',
        name: '日常活动',
        component: richanghuodong
      }
      ,{
	path: '/ketangpingjia',
        name: '课堂评价',
        component: ketangpingjia
      }
      ,{
	path: '/ketangdianming',
        name: '课堂点名',
        component: ketangdianming
      }
      ,{
	path: '/ketangqingjia',
        name: '课堂请假',
        component: ketangqingjia
      }
      ,{
	path: '/xueyuan',
        name: '学员',
        component: xueyuan
      }
      ,{
	path: '/ketangqiandao',
        name: '课堂签到',
        component: ketangqiandao
      }
      ,{
	path: '/zuoyetijiao',
        name: '作业提交',
        component: zuoyetijiao
      }
      ,{
	path: '/shoukejiaoshi',
        name: '授课教师',
        component: shoukejiaoshi
      }
      ,{
	path: '/discusskechengxinxi',
        name: '课程信息评论',
        component: discusskechengxinxi
      }
      ,{
	path: '/kechengxinxi',
        name: '课程信息',
        component: kechengxinxi
      }
      ,{
	path: '/kechengleixing',
        name: '课程类型',
        component: kechengleixing
      }
      ,{
	path: '/xuexijilu',
        name: '学习记录',
        component: xuexijilu
      }
      ,{
	path: '/jiaoxueban',
        name: '教学班',
        component: jiaoxueban
      }
      ,{
	path: '/discussrichanghuodong',
        name: '日常活动评论',
        component: discussrichanghuodong
      }
      ,{
	path: '/huodongbaoming',
        name: '活动报名',
        component: huodongbaoming
      }
      ,{
	path: '/jiaofujiaoshi',
        name: '教辅教师',
        component: jiaofujiaoshi
      }
      ,{
	path: '/huodongpingjia',
        name: '活动评价',
        component: huodongpingjia
      }
      ,{
	path: '/config',
        name: '轮播图管理',
        component: config
      }
      ,{
	path: '/kechengjindu',
        name: '课程进度',
        component: kechengjindu
      }
      ,{
	path: '/huodongleixing',
        name: '活动类型',
        component: huodongleixing
      }
      ,{
	path: '/newstype',
        name: '通知公告分类',
        component: newstype
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {icon:'', title:'login'}
  },
  {
    path: '/register',
    name: 'register',
    component: register,
    meta: {icon:'', title:'register'}
  },
  {
    path: '*',
    component: NotFound
  }
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  mode: 'hash',
  /*hash模式改为history*/
  routes // （缩写）相当于 routes: routes
})
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
export default router;
